



class Lex{
    constructor(){
        this.noun=[];   //名词
        this.type=[];   //类型
        this.order=[]; //程序
        this.real=[];   //关系
    }

    lex(dataStr){
        this.heap =new Array();
        this.stact=new Array();
        this.pid=null;
        let sertC= this.lexNames(dataStr)
        this.regContrast(sertC);
        return this.heap;
    }


    lexNames(strs) {
        var ch = '';
        var text;
        var dotID = [  ',', '.','，','。' ]
        var sertConst = [];

        text = strs.toString().split('');

        for (var i = 0; i < text.length;) {
            var strToken = '';
            ch = text[i];
            var tag = 0;
            if(ch == '<' || ch == '>' || ch == '\/' || ch =='?'){
                sertConst.push(ch);
                i += 1;
                ch = text[i];

            } else if( ch == '\n' || ch == '\t'|| ch == " ") {
                i += 1;
                ch = text[i];
            } else   {
                while (ch != '<' && ch != '>' && ch != '\/' && ch != '?' && ch != '\n' && ch != '\t'&& ch != " ") {
                    strToken += ch;
                    i ++;
                    ch = text[i];
                }
                if (sertConst.length != 0 && tag === 0) {
                    for (var t = 0; t < sertConst.length; t++) {

                        if (sertConst[t] === strToken && tag === 0) {
                            tag = 1;
                            break;
                        }
                        else {
                            sertConst.push(strToken);
                            tag = 1;
                            var put = sertConst.length - 1
                            break;
                        }
                    }
                }
            }
        }

        return sertConst;
    }
}